[Home]Hooking Up A MPG Pendant

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Search:

This page is to explain how to hook up the common MPG pendants found on the market place today. This example uses a MPG3 pendant and a C22 pendant interface card from [CNC4PC] and a second parallel port plugged into the PCI slot and EMC 2.2.x. This example gives you 3 axis with 3 step increments of 0.1, 0.01, 0.001.

1. Figure out the address of your parallel port card

To find the address of your parallel port card in a terminal window

 lspci -v
You will see something similar to this
 0000:00:10.0 Communication controller: NetMos Technology PCI 1 port parallel adapter (rev 01)
        Subsystem: LSI Logic / Symbios Logic: Unknown device 0010
        Flags: medium devsel, IRQ 11
        I/O ports at a800 [size=8]
        I/O ports at ac00 [size=8]
        I/O ports at b000 [size=8]
        I/O ports at b400 [size=8]
        I/O ports at b800 [size=8]
        I/O ports at bc00 [size=16]

In my case the address was the first one so I changed my .hal file from

 loadrt hal_parport cfg=0x378
to
 loadrt hal_parport cfg="0x378 0xa800 in"

note the double quotes surrounding the addresses.

and added

 addf parport.1.read base-thread
 addf parport.1.write base-thread

so the parport will get read and written to.

2. Hook up the hardware

You need to supply the interface board with 5 vdc. I just hacked a plug from a busted fan and plugged into a large plug from the power supply of the computer the black and red wires. Electricity don't know what color wires are so use your meter to verify you have the voltage you need.

3. Add some code

In your custom.hal file or other .hal file add the following making sure you don't have mux4 or an encoder already in use. If you do just increase the counts and change the encoder and or mux4 reference number as needed. Delete the addf lines for any components you already have in your main hal file.

 # Jog Pendant
 loadrt encoder num_chan=1
 loadrt mux4 count=1

 addf encoder.capture-position servo-thread
 addf encoder.update-counters base-thread
 addf mux4.0 servo-thread

 # for absolute mode (for every click you get a move ie, if you spin the dial it may keep moving after you stop the dial)
 # default so does not need to be set
 setp axis.N.jog-vel-mode 0

 # for velocity mode (when you stop spinning the dial the axis stops)
 # must be set for each axis
 setp axis.N.jog-vel-mode 1

 # "times 4 mode" one count per full quadrature cycle, instead of the usual one count per edge.  
 # mpg jog wheels often have a full quadrature cycle per "click". 0 for off and 1 for on.
 setp encoder.0.x4-mode 0

 setp mux4.0.in0 0.1
 setp mux4.0.in1 0.01
 setp mux4.0.in2 0.001

 net scale1 mux4.0.sel0 <= parport.1.pin-09-in
 net scale2 mux4.0.sel1 <= parport.1.pin-10-in

 net pend-scale axis.0.jog-scale <= mux4.0.out
 net pend-scale axis.1.jog-scale
 net pend-scale axis.2.jog-scale

 net mpg-a encoder.0.phase-A <= parport.1.pin-02-in
 net mpg-b encoder.0.phase-B <= parport.1.pin-03-in

 net mpg-x axis.0.jog-enable <= parport.1.pin-04-in
 net mpg-y axis.1.jog-enable <= parport.1.pin-05-in
 net mpg-z axis.2.jog-enable <= parport.1.pin-06-in

 net pend-counts axis.0.jog-counts <= encoder.0.counts
 net pend-counts axis.1.jog-counts
 net pend-counts axis.2.jog-counts

4. Links to other MPG examples

 http://www.anderswallin.net/2006/11/jogging-emc2/ Example using a Mesa m5i20
 http://www.chembal.com/cnc/mpg2-emc2-integration/ 4-Axis Example

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited August 11, 2011 7:32 am by Jthornton (diff)Published under a Creative Commons License